Advanced topics F
Arbitration between the Matlab and device server The arbitration is performed via control files in the configuration directory "/home/kx1/var" on the server Lin-kx1-off.jet.uk #If device server is running and controlls the particular detector, the file w_running and/or ni_running is created. #When Matlab wants to take over control, it creates the file w_inhibit or ni_inhibit respectively #The devices server checks for existence of these files in each calibration/measurement cycle, and confirms, that request has been accepted, creating the w_inhibited or ni_inhibited file. #After the appropriate confirmation file is detected, Matlab is free to control the corresponding detector. #When Matlab wants to give control back to the device server, it deletes the appropriate file: w_inhibit and/or ni_inhibit. #The device server confirms, that it took over the control, deleting the corresponding confirmation file(s) w_inhibited or ni_inhibited '''and the file '''w_running and/or ni_running is created. I yet need to add a functionality, which will inform CODAS, that the system has been disabled, and it can't produce data for CODAS Matlab inhibit control function: 'R=ServerInhibitViaFTPdefault(sn, tout, iflag) '''in file 'KX1.m' *''sn ''- system number: 1-W, 2-Ni *''tout - timeout in sec, preferable value: 210 sec *''iflag'' - inhibit request: 0 - no inhibit, server controls system, 1 - inhibit, matlab controls system Function returns R value: 1-success, 0-error occured during function execution Example of inhibit enable for system 2 (command window): >> KX1.ServerInhibitViaFTPdefault(2,210, 1) FTP connecting to "kx1@lin-kx1-off.jet.uk" ... done waiting for server deactivation ... .....1... done FTP closing connection ... done Example of inhibit disable :for system 2 (command window): >> KX1.ServerInhibitViaFTPdefault(2,210, 0) FTP connecting to "kx1@lin-kx1-off.jet.uk" ... done waiting for server activation ... done FTP closing connection ... done IMPORTANT! Some operations may be perfomed by Matlab without requesting exclusive access in the above described way #The meteo server may be read without inhibiting the device server #The HV server may be accessed without inhibiting the device server #The new configuration may be sent to the lin-kx1-off machine, without inhibiting the device server. Configuration for Ni detector should be sent to the port 54301, while configuration for W detector should be sent to the port 54302. The configuration may be sent at eny time. If the "arm" is received during reception of the new configuration, the measurement will be simply performed with the old configuration... Format of files on the lin-kx1-off in the mon directory The device server performs measurements and stores data for further Matlab processing in the /home/kx1/mon directory. Currently the file names are created in the following way: #Files with data from pulses: #*w-pulse-NUMBER.zip or ni-pulse-NUMBER.zip (e.g. ni-pulse-0084360.zip ) #Files with calibration data from Iron source: #*w-mon-DATE-TIME.zip or ni-mon-DATE-TIME.zip (e.g.ni-mon-2013-07-12_16-08-45.zip) (Tomek suggested change of the name generation ni-pla-PULSE_NUMBER.zip for plasma pulse, ni-cal-PULSE_NUMBER-MEASUREMENT_NUMBER.zip for calibration pulse) All those files are standard zip archives, containing the following files: *config - configuration of the electronic box in the same format, in which it is sent from Matlab *hist_all - position histograms , data type - uint32_be, size: n_hists x 256 *hist_en - energy (charge) histograms, data type - uint32_be, size: n_hists x 512 *hv - voltages from HV power supply, data type float64_be, size: 7 (if HV power supply link crashes, all voltages are reported as -1.0V) *rate0 - rate counter 0, data type - uint16_be, size: n_hists x 256 *rate1 - rate counter 1, data type - uint16_be, size: n_hists x 256 *raw.gz - gzipped raw histogram data, data type - uint16_be, size: n_hists x 256 x 512 *sensors - XML data from internal sources *time_vec - timing vector, data type - float64_be, size 2 x n_hists, first row contains start moment of the histogram (related to PRE), second row contains the duration of the particular histogram